home *** CD-ROM | disk | FTP | other *** search
/ Aminet 21 / Aminet 21 (1997)(GTI - Schatztruhe)[!][Oct 1997].iso / Aminet / dev / misc / gms_dev.lha / GMS / Source / Asm / Blitter / RandomPlot.s < prev    next >
Encoding:
Text File  |  1997-07-08  |  2.6 KB  |  104 lines

  1. ;-------T-------T------------------------T----------------------------------;
  2. ;Name:      Random Plot
  3. ;Author:    Paul Manias
  4. ;Copyright: DreamWorld Productions (c) 1996-1997.  Freely distributable.
  5. ;
  6. ;This is a graphical demonstration of the Random() functions.  The default
  7. ;is to use FastRandom, but you can change it to SlowRandom if you look
  8. ;below.
  9. ;
  10. ;LMB exits.
  11.  
  12.     INCDIR    "INCLUDES:"
  13.     INCLUDE    "games/games_lib.i"
  14.     INCLUDE    "games/games.i"
  15.  
  16. Random    =    _LVOFastRandom    ;_LVOFastRandom() or _LVOSlowRandom().
  17.  
  18.     SECTION    "RandomPlot",CODE
  19.  
  20. ;===========================================================================;
  21. ;                             INITIALISE DEMO
  22. ;===========================================================================;
  23.  
  24.     STARTGMS
  25.  
  26. Start:    MOVEM.L    A0-A6/D1-D7,-(SP)
  27.     move.l    GMSBase(pc),a6
  28.     CALL    AllocBlitter
  29.     tst.l    d0
  30.     bne.s    .Error_Blitter
  31.  
  32.     lea    ScreenTags(pc),a0
  33.     CALL    ShowScreen
  34.     tst.l    d0
  35.     beq.s    .Error_Screen
  36.  
  37.     bsr.s    Main
  38.  
  39. .ReturnToDOS
  40.     move.l    GMSBase(pc),a6
  41.     move.l    Screen(pc),a0
  42.     CALL    DeleteScreen
  43. .Error_Screen
  44.     CALL    FreeBlitter
  45. .Error_Blitter
  46.     MOVEM.L    (SP)+,A0-A6/D1-D7
  47.     moveq    #ERR_OK,d0
  48.     rts
  49.  
  50. ;===========================================================================;
  51. ;                                MAIN LOOP
  52. ;===========================================================================;
  53.  
  54. Main:    move.l    GMSBase(pc),a6
  55. .loop    moveq    #JPORT1,d0
  56.     moveq    #JT_ZBXY,d1
  57.     CALL    ReadJoyPort
  58.     btst    #MB_LMB,d0
  59.     bne.s    .done
  60.  
  61.     move.l    Screen(pc),a0
  62.     move.l    GS_AmtColours(a0),d1    ;Get random colour.
  63.     subq.l    #1,d1
  64.     jsr    Random(a6)    ;>> = Get random number.
  65.     addq.l    #1,d0
  66.     move.l    d0,d3    ;d3 = Colour to use.
  67.  
  68.     move.w    GS_ScrWidth(a0),d1    ;Get random X.
  69.     jsr    Random(a6)    ;>> = Get random number.
  70.     move.w    d0,d4    ;d4 = Store X to use.
  71.  
  72.     move.w    GS_ScrHeight(a0),d1    ;Get random Y.
  73.     jsr    Random(a6)    ;>> = Get random number.
  74.     move.w    d0,d2    ;d2 = Y to use.
  75.     move.w    d4,d1    ;d1 = Get back X.
  76.  
  77.     move.l    Screen(pc),a0
  78.     move.l    GS_Bitmap(a0),a0
  79.     CALL    DrawUCPixel
  80.     CALL    AutoSwitch
  81.     bra.s    .loop
  82.  
  83. .done    rts
  84.  
  85. ;===========================================================================;
  86. ;                                  DATA
  87. ;===========================================================================;
  88.  
  89. ScreenTags:
  90.     dc.l    TAGS_GAMESCREEN
  91. Screen:    dc.l    0
  92.     dc.l    GSA_Palette,.palette
  93.     dc.l    GSA_AmtColours,32
  94.     dc.l    GSA_ScrWidth,640
  95.     dc.l    GSA_ScrHeight,512
  96.     dc.l    GSA_ScrMode,HIRES|LACED
  97.     dc.l    TAGEND
  98. .palette
  99.     dc.l    $000000,$109000,$F0C0B0,$F0A090,$D08080,$906050,$604040,$201010
  100.     dc.l    $400060,$404040,$F0F000,$403020,$C0C000,$109000,$500010,$808000
  101.     dc.l    $206010,$207010,$308020,$409020,$50A030,$50B040,$607070,$60C040
  102.     dc.l    $708080,$90A0A0,$B0C0C0,$800010,$900010,$A00020,$700010,$600010
  103.  
  104.